<!DOCTYPE html>
<html >
<meta charset="utf-8">
<head >
<#include "/page/include.ftl">

</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-mq-add">
			<input name="deptId"  type="hidden" id="treeId"/>
			<div class="form-group">
				<label class="col-sm-3 control-label ">源系统名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="name" name="name" value="${name!}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">机器名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="host" name="host" value="${host!}"/>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">端口号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" id="prot" name="prot" value="${port!}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">用户名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="username" id="username"  value="${username!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">密码：</label>
				<div class="col-sm-8">
					<input class="form-control" type="password" name="password" id="password" value="${password!}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">本地目录：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="localpath" id="localpath"  value="${localpath!}" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">远程路径：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="rmotepath" id="rmotepath"  value="${rmotepath!}" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">作业文件名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="filesystem" id="id" value="${id!}" readonly="readonly"/>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">文件同步类型：</label>
				<div class="col-sm-8">
					<select id="syncType" name="syncType" class="form-control m-b" with="100px">
					<option value="${syncType!}"><#if syncType=="1">全量 <#elseif syncType=="2">增量 </#if></option>
			               <option value="1">全量</option>
 				           <option value="2">增量</option>
	                   
	                </select>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">定时任务表达式：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="corn" id="corn" value="${cronexpress!}">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">数据分隔符：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="splitformate" id="splitformate"  value="${splitformate!}" />
				
				</div>
			</div>
			
			
			<div class="form-group">
				<label class="col-sm-3 control-label">目标库名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="disname" id="disname"  value="${dbname!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">目标库类型：</label>
				<div class="col-sm-8">
					<select id="dbtype" name="dbtype" class="form-control m-b" with="100px">
					<option value="${dbtype!}"><#if dbtype=="1">oracle <#elseif dbtype=="2">mysql </#if></option>
			               <option value="1">oracle</option>
 				           <option value="2">mysql</option>
	                   
	                </select>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">数据库url：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="url" id="url"  value="${url!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">数据库用户名：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="dbusername" id="dbusername"  value="${dbusername!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">数据库密码：</label>
				<div class="col-sm-8">
					<input class="form-control" type="password" name="dbpassword" id="dbpassword"   value="${dbpassword!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">数据库对应表：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="table" id="table" value="${table!}" />
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">列字段：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="clonums" id="clonums" value="${clonums!}" />
				</div>
			</div>
			
		</form>
	</div>
	
	<script src="${rc.contextPath}/static/ajax/libs/select/select2.js"></script>
	<script>
       function submitHandler() {
	      update();
	       
	    }
        
        function update() {
       
        	var name = $("input[name='name']").val();
        	var corn = $("input[name='corn']").val();
        	var host = $("input[name='host']").val();
        	var prot = $("input[name='prot']").val();
        	var url = $("input[name='url']").val();
        	var username = $("input[name='username']").val();
        	var password = $("input[name='password']").val();
        	var topic = $("input[name='topic']").val();
        	var rmotepath = $("input[name='rmotepath']").val();
        	var localpath = $("input[name='localpath']").val();
        	var filesystem = $("input[name='filesystem']").val();
        	var splitformate = $("input[name='splitformate']").val();
        	var disname = $("input[name='disname']").val();
        	var dbtype = $("#dbtype option:selected").val();
        	var url = $("input[name='url']").val();
        	var dbpassword = $("input[name='dbpassword']").val();
        	var dbusername = $("input[name='dbusername']").val();
        	var table = $("input[name='table']").val();
        	var clonums = $("input[name='clonums']").val();
        	var syncType = $("#syncType option:selected").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "ftp/update",
        		data : {
        			"name": name,
        			"corn":corn,
        			"host": host,
        			"prot": prot,
        			"url": url,
        			"username": username,
        			"password": password,
        			"rmotepath": rmotepath,
        			"filesystem": filesystem,
        			"localpath": localpath,
        			"topic": topic,
        			"splitformate":splitformate,
        			"disname":disname,
        			"dbtype":dbtype,
        			"syncType":syncType,
        			"url":url,
        			"dbpassword":dbpassword,
        			"dbusername":dbusername,
        			"table":table,
        			"clonums":clonums
        		},
        		async : false,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.successCallback(data);
        		}
        	});
        }

        
		
		
    </script>
</body>
</html>
